package com.yupi.yangoj.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yupi.yangoj.model.dto.questionsubmit.QuestionSubmitAddRequest;
import com.yupi.yangoj.model.dto.questionsubmit.QuestionSumitQueryRequest;
import com.yupi.yangoj.model.entity.Question;
import com.yupi.yangoj.model.entity.QuestionSubmit;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yupi.yangoj.model.entity.User;
import com.yupi.yangoj.model.vo.QuestionSubmitVO;
import com.yupi.yangoj.model.vo.QuestionVO;
import javax.servlet.http.HttpServletRequest;

/**
* @author Young
* @description 针对表【question_submit(题目提交表)】的数据库操作Service
* @createDate 2024-01-09 10:17:42
*/
public interface QuestionSubmitService extends IService<QuestionSubmit> {


    /**
     * 用户提交题目
     * @param questionSubmitAddRequest  提交的题目对象
     * @param loginUser     用户对象
     * @return
     */
    long doQuestionSubmit(QuestionSubmitAddRequest questionSubmitAddRequest, User loginUser);

    /*
     封装了事务的方法，由doQuestionSubmit调用
     */
    int doQuestionSubmitInner(Long userId, long questionId);


    /**
     * 获取查询条件
     *
     * @param questionSumitQueryRequest
     * @return
     */
    QueryWrapper<QuestionSubmit> getQueryWrapper(QuestionSumitQueryRequest questionSumitQueryRequest);

    /**
     * 获取题目封装
     *
     * @param questionSubmit
     * @param loginUser
     * @return
     */
    QuestionSubmitVO getQuestionSubmitVO(QuestionSubmit questionSubmit, User loginUser);

    /**
     * 获取单个题目提交的详情数据
     *
     * @param questionSubmit
     * @param loginUser
     * @return
     */
    QuestionSubmitVO getQuestionSubmitDetailVO(QuestionSubmit questionSubmit, User loginUser);

    /**
     * 分页获取题目封装
     *
     * @param questionSubmitPage
     * @param loginUser
     * @return
     */
    Page<QuestionSubmitVO> getQuestionSubmitVOPage(Page<QuestionSubmit> questionSubmitPage, User loginUser);

}
